1. /* scfccosh.cpp by K.Tsuru */
  2. // function ID = 9109
  3. /*****************************************
  4. SComplex class
  5. It returns cosh(z).
  6. Let z = x+iy,
  7. cosh(z) = cosh(x)*cos(y)+i*sinh(x)sin(y).
  8. *****************************************/
  9. #ifndef SN_H
  10. #include "sn.h"
  11. #endif
  12. #define UseCSBSccosh 1
  13. SComplex Ccosh(const SComplex& z)
  14. {
  15. #if UseCSBSccosh // 16.06 sec
  16. SDouble chx, shx, cy, sy, x(Re(z)), y(Im(z));
  17. Hyperbolic(x, chx, shx); // chx = cosh(x) shx = sinh(x)
  18. CosSinBS(y, cy, sy); // cy = cos(y), sy = sin(y);
  19. return SComplex(chx*cy, shx*sy);
  20. #else // 16.16 sec
  21. SDouble rr, ri, sh, s, c;
  22. sh = Sinh(z.Real());
  23. s = Sin(z.Imag());
  24. if( (s.PreferSpeed() == ON) && (s.NetRdxExp() > -2) ){
  25. c = Sqrt(1.0-s*s); // |s| is O(1.0).
  26. }else c = Cos(z.Imag()); // |s| is very small.
  27. rr = Sqrt(1.0+sh*sh)*c; // cosh(x)*cos(y)
  28. ri = sh*s; // sinh(x)*sin(y)
  29. return SComplex(rr, ri);
  30. #endif
  31. }

scfccosh.cpp : last modifiled at 2015/08/17 11:07:02(943 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:08 (Fri Oct 06 15:27:08 2017).